
/*公共组建*/
layui.use(['carousel', 'util'], function () {
    var carousel = layui.carousel,
        util = layui.util;
    if ($('.layui-carousel').size() > 0) {
        const option = {
            elem: '',
            width: '100%',
            height: '300px',
            full: false,
            anim: 'fade',
            autoplay: true,
            interval: 3000,
            index: 0,
            arrow: 'hover',
            indicator: 'inside',
            trigger: '',
        }
        $('.layui-carousel').each(function (k, v) {
            let id = $(v).attr('id');
            let data_option = $(v).data();
            let options = $.extend(option, data_option)
            options['elem'] = '#' + id;
            carousel.render(options);
        })
    }
    util.fixbar();
});

/*搜索框内容*/
$(".type").click(function () {
    $(this).find('ul').fadeToggle(200).siblings('button').toggleClass('open');
})

$('.type ul li').on('click', function () {
    var content = $(this).html() + '<i class="icon icon-down"></i>'
        , info = $(this).data('info')
        , site = $(this).data('type');
    $('#search-input').attr('placeholder', info).attr('title', info)
    $('.type>button').html(content).attr('data-event', site)
});
